Microcontrollers such as 100 depicted in FIG. 1, generally include a processor (Central Processing Unit) 106 and associated Random Access Memory (RAM) 110 as well as a block of nonvolatile memory 116, generally flash memory, used to store a user program. By using a block of user programmable nonvolatile memory 116, the microcontroller may be customized to carry out any desired function within the capabilities of the device. Numerous techniques exist for programming the user program into the nonvolatile memory 116. In general, such techniques may be characterized by use of an external tester/programmer 120 coupled directly to the nonvolatile memory 116. The tester/programmer 120 utilizes a control signal line 124 to appropriately signal the nonvolatile memory 116 (as well as associated circuitry within the microcontroller 100) that a programming mode is being entered. An address line, path or bus 130 is then used to identify memory locations within the nonvolatile memory 116 being programmed. Data is transmitted to the nonvolatile memory 116 over a data line, path or bus 138. When all address locations have been appropriately programmed within the nonvolatile memory 116, the tester/programmer 120 issues appropriate control signals on control path 124 to terminate the programming process.
The details of the exact programming process vary from manufacturer to manufacturer and from part to part. However, the above characterization generally describes the process used. Unfortunately, the process of programming the microcontroller 100 as depicted in FIG. 1 presents a number of problems. The need to bring control data and address lines to the outside requires that the microcontroller 100 frequently have more I/O (input/output) pads on the processor then might otherwise be necessary. In addition, the external accessibility to control path 124, address path 130 and data path 138 renders microcontroller 100 susceptible to unauthorized memory reads, programming or reprogramming. This may present a serious security problem making microcontroller 100 vulnerable to unauthorized modification of a user program including potentially infecting the user program with “bugs” and “viruses”.
In addition to the above drawbacks, microcontroller 100 requires external interconnection with a programmer/tester any time the nonvolatile memory 116 is to be programmed. Thus, there is no provision for processor 106 itself to invoke a reprogramming “on the fly”. In many applications for microcontrollers it would be an advantage to have the processor 106 invoke a reprogramming of certain memory locations within nonvolatile memory 116 as a routine part of the microcontroller's operation. Such an ability for the microcontroller to essentially independently reprogram itself opens the door to microcontroller learning and adapting its program or program parameters to varying circumstances within its surroundings. For example, constants stored within the user program could be adjusted to compensate for drifting component values, environmental factors, running averages, minimum and maximum values encountered, etc.